package com.cskaoyan.market.controller.admin;

import com.cskaoyan.market.service.MarketAdminService;
import com.cskaoyan.market.service.impl.MarketAdminServiceImpl;
import com.cskaoyan.market.util.JacksonUtil;
import com.cskaoyan.market.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
@RestController
@RequestMapping("admin/dashboard")
public class AdminDashBoardController {
    @Autowired
    MarketAdminService adminService;
    @GetMapping
    protected Object comment(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // 1.调用业务层获取data
        HashMap<String,Long> dashboardMap = adminService.getDashboard();

        // 2.拼接errno、errmsg
        Object ok = ResponseUtil.ok(dashboardMap);

        // 3.拼接成json字符串
        return ok;
    }
}
